﻿<!--
  
   CombatWindow.xaml
  
   Copyright (c) 2007 Mike Strobel
  
   This source code is subject to the terms of the Microsoft Reciprocal License (Ms-RL).
   For details, see <http://www.opensource.org/licenses/ms-rl.html>.
  
   All other rights reserved.
  
  -->
<Window x:Class="Supremacy.Client.CombatWindow"
        xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ui="clr-namespace:Supremacy.UI;assembly=SupremacyUI"
        xmlns:s="clr-namespace:Supremacy.Client;assembly=SupremacyWPF"
        xmlns:combat="clr-namespace:Supremacy.Combat;assembly=SupremacyCore"
        xmlns:orbitals="clr-namespace:Supremacy.Orbitals;assembly=SupremacyCore"
        xmlns:bldg="clr-namespace:Supremacy.Buildings;assembly=SupremacyCore"
        xmlns:tech="clr-namespace:Supremacy.Tech;assembly=SupremacyCore"
        xmlns:universe="clr-namespace:Supremacy.Universe;assembly=SupremacyCore"
        xmlns:local="clr-namespace:Supremacy.Client"
        Title="Supremacy.Client"
        Background="Black"
        ShowInTaskbar="False"
        SnapsToDevicePixels="True"
        WindowStyle="None"
        WindowStartupLocation="CenterOwner"
        ResizeMode="NoResize"
        SizeToContent="WidthAndHeight">
  <Window.Resources>
    <Style TargetType="{x:Type TreeViewItem}">
      <Setter Property="Foreground"
              Value="{DynamicResource HeaderTextBrush}"/>
      <Setter Property="FontSize"
              Value="12pt"/>
      <Setter Property="SnapsToDevicePixels"
              Value="True"/>
    </Style>
    <DataTemplate x:Key="AssetTreeItemTemplate">
      <DockPanel LastChildFill="True"
                 Margin="0,2,0,2">
        <ui:BlockBar DockPanel.Dock="Left"
                     ui:BlockBar.IsReadOnly="True"
                     BlockCount="12"
                     BlockMargin="3"
                     BlockBrush="Magenta"
                     Value="{Binding Path=ShieldIntegrity, Mode=OneWay}"
                     Height="5"
                     Margin="0,0,4,0"
                     Width="45"
                     VerticalAlignment="Top">
          <ui:BlockBar.LayoutTransform>
            <RotateTransform Angle="270"/>
          </ui:BlockBar.LayoutTransform>
        </ui:BlockBar>
        <ui:BlockBar DockPanel.Dock="Left"
                     ui:BlockBar.IsReadOnly="True"
                     BlockCount="12"
                     BlockMargin="3"
                     BlockBrush="Lime"
                     Value="{Binding Path=HullIntegrity, Mode=OneWay}"
                     Height="5"
                     Margin="0,0,4,0"
                     Width="45"
                     VerticalAlignment="Top">
          <ui:BlockBar.LayoutTransform>
            <RotateTransform Angle="270"/>
          </ui:BlockBar.LayoutTransform>
        </ui:BlockBar>
        <Border x:Name="ImageBorder"
                DockPanel.Dock="Left"
                VerticalAlignment="Top"
                Width="54"
                Height="45"
                BorderBrush="White"
                BorderThickness="2"
                CornerRadius="8">
          <Border.Background>
            <ImageBrush ImageSource="{Binding Path=Source.Design, Converter={StaticResource TechObjectImageConverter}}"
                        Stretch="UniformToFill"/>
          </Border.Background>
          <Image Source="{Binding Path=Owner, Converter={StaticResource CivInsigniaConverter}}"
                 HorizontalAlignment="Right"
                 VerticalAlignment="Bottom"
                 Margin="0,0,4,4"
                 Width="16"
                 Height="16"
                 Stretch="Uniform">
            <!--<UIElement.Effect>
              <DropShadowEffect ShadowDepth="0"
                                BlurRadius="10.0"
                                Color="Black"
                                Opacity="1.0" />
            </UIElement.Effect>-->
          </Image>
        </Border>
        <StackPanel Orientation="Vertical"
                    Margin="6,0,0,0"
                    TextBlock.FontFamily="{DynamicResource ParagraphFont}"
                    TextBlock.FontSize="10pt"
                    TextBlock.Foreground="{DynamicResource DefaultTextBrush}"
                    TextBlock.TextAlignment="Left">
          <StackPanel Orientation="Horizontal">
            <TextBlock Foreground="{DynamicResource HeaderTextBrush}"
                       Text="{Binding Path=Name, Converter={StaticResource StringResourceConverter}}"/>
            <TextBlock x:Name="DestroyedText"
                       Foreground="Crimson"
                       Margin="12,0,0,0"
                       Visibility="Collapsed" 
                       Text="{s:StringResource COMBAT_DESTROYED}"/>
          </StackPanel>
          <TextBlock Text="{Binding Path=Description}"/>
          <Grid>
            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="0.5*"/>
              <ColumnDefinition Width="0.5*"/>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Column="0"
                        Orientation="Horizontal">
              <TextBlock Text="Shields: "/>
              <TextBlock Text="{Binding Path=ShieldStrength}"/>
              <TextBlock Text="/"/>
              <TextBlock Text="{Binding Path=Source.OrbitalDesign.ShieldStrength}"/>
            </StackPanel>
            <StackPanel Grid.Column="1"
                        Orientation="Horizontal"
                        Margin="12,0,0,0">
              <TextBlock Text="Hull: "/>
              <TextBlock Text="{Binding Path=HullStrength}"/>
              <TextBlock Text="/"/>
              <TextBlock Text="{Binding Path=Source.OrbitalDesign.HullStrength}"/>
            </StackPanel>
          </Grid>
        </StackPanel>
      </DockPanel>
      <DataTemplate.Triggers>
        <DataTrigger Binding="{Binding Path=IsCloaked}"
                     Value="True">
          <Setter TargetName="ImageBorder"
                  Property="Opacity"
                  Value="0.33"/>
        </DataTrigger>
        <DataTrigger Binding="{Binding Path=IsDestroyed}"
                     Value="True">
          <Setter TargetName="DestroyedText"
                  Property="Visibility"
                  Value="Visible"/>
        </DataTrigger>
      </DataTemplate.Triggers>
    </DataTemplate>

  </Window.Resources>

  <Grid 
        Height="600"
        Width="800">
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="0.5*"/>
      <ColumnDefinition Width="0.5*"/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="*"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>

    <StackPanel Grid.Column="0"
                Grid.ColumnSpan="2"
                Grid.Row="0"
                Margin="6"
                Orientation="Vertical">
      <TextBlock x:Name="HeaderText"
                 FontSize="20pt"
                 FontFamily="{DynamicResource DefaultFont}"
                 Foreground="{DynamicResource HeaderTextBrush}"
                 HorizontalAlignment="Center"/>
      <TextBlock x:Name="SubHeaderText"
                 FontSize="12pt"
                 FontFamily="{DynamicResource ParagraphFont}"
                 Foreground="{DynamicResource DefaultTextBrush}"
                 TextAlignment="Center"
                 HorizontalAlignment="Center"/>
    </StackPanel>

    <GroupBox Header="{s:StringResource COMBAT_FRIENDLY_UNITS}"
              Grid.Column="0"
              Grid.Row="1"
              Margin="6">
      <ScrollViewer HorizontalScrollBarVisibility="Disabled"
                    VerticalScrollBarVisibility="Auto"
                    CanContentScroll="False">
        <TreeView x:Name="FriendlyAssetsTree"
                  BorderThickness="0"
                  FontFamily="{DynamicResource ParagraphFont}"
                  FontSize="10pt"
                  ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                  ScrollViewer.VerticalScrollBarVisibility="Disabled"/>
      </ScrollViewer>
    </GroupBox>

    <GroupBox Header="{s:StringResource COMBAT_HOSTILE_UNITS}"
              Grid.Column="1"
              Grid.Row="1"
              Margin="6">
      <ScrollViewer HorizontalScrollBarVisibility="Disabled"
                    VerticalScrollBarVisibility="Auto"
                    CanContentScroll="False">
        <TreeView x:Name="HostileAssetsTree"
                  BorderThickness="0"
                  FontFamily="{DynamicResource ParagraphFont}"
                  FontSize="10pt"
                  ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                  ScrollViewer.VerticalScrollBarVisibility="Disabled"/>
      </ScrollViewer>
    </GroupBox>

    <StackPanel x:Name="ButtonsPanel"
                Margin="6"
                Grid.Column="0"
                Grid.ColumnSpan="2"
                Grid.Row="2"
                Orientation="Horizontal"
                HorizontalAlignment="Center">
      <Button x:Name="EngageButton"
              Style="{DynamicResource StandardButtonStyle}"
              Content="{s:StringResource COMBAT_ENGAGE}"
              Click="OnOrderButtonClicked"/>
      <Button x:Name="HailButton"
              Style="{DynamicResource StandardButtonStyle}"
              Margin="6,0,0,0"
              Content="{s:StringResource COMBAT_HAIL}"
              Click="OnOrderButtonClicked"/>
      <Button x:Name="RetreatButton"
              Style="{DynamicResource StandardButtonStyle}"
              Margin="6,0,0,0"
              Content="{s:StringResource COMBAT_RETREAT}"
              Click="OnOrderButtonClicked"/>
    </StackPanel>
    <Button x:Name="CloseButton"
            Style="{DynamicResource StandardButtonStyle}"
            Margin="6"
            Grid.Column="0"
            Grid.ColumnSpan="2"
            Grid.Row="3"
            HorizontalAlignment="Center"
            Content="{s:StringResource COMBAT_CLOSE}"
            Visibility="Collapsed"
            Click="OnCloseButtonClicked"/>
  </Grid>
</Window>
